package cas.ihep.spark.util;

import scala.Tuple2;

public interface IterationClientKVListener<K,V,T,R> extends IterationClientListener<Tuple2<K,V>,T,R>{
    void initialize(NamedResourceManager manager,K k,V v);
    default void initialize(NamedResourceManager manager,Tuple2<K,V> tp){
        initialize(manager,tp._1(),tp._2());
    }
    R iterate(NamedResourceManager manager,K k,V v,T t);
    default R iterate(NamedResourceManager manager,Tuple2<K,V> tp,T t){
        return iterate(manager,tp._1(),tp._2(),t);
    }
    void cleanup(NamedResourceManager manager,K k,V v);
    default void cleanup(NamedResourceManager manager,Tuple2<K,V> tp){
        cleanup(manager,tp._1(),tp._2());
    }
}
